package com.iscas.loadstorm.isloadstorm.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 
 * @TableName load_api
 */
@TableName(value ="load_api")
@Data
public class LoadApi implements Serializable {
    /**
     * 负载API id
     */
    @TableId
    private String id;

    /**
     * 负载id
     */
    private String loadId;

    /**
     * 目标服务
     */
    private String targetService;

    /**
     * 用户数量
     */
    private Integer userCount;

    /**
     * 负载模式(0:constant,1: ramp-up)
     */
    private String loadPattern;

    /**
     * 持续时间
     */
    private String duration;

    /**
     * 自定义url
     */
    private String requestUrl;

    /**
     * 自定义参数
     */
    private String requestParams;

    /**
     * 创建时间
     */
    private Date createdTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 是否删除
     */
    private Integer isDelete;

    /**
     * http方法
     */
    private String httpMethod;

    /**
     * 请求头
     */
    private String customHeaders;

    /**
     * 请求体
     */
    private String requestBody;

    /**
     * 爬升时间
     */
    private Integer rampUpTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        LoadApi other = (LoadApi) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getLoadId() == null ? other.getLoadId() == null : this.getLoadId().equals(other.getLoadId()))
            && (this.getTargetService() == null ? other.getTargetService() == null : this.getTargetService().equals(other.getTargetService()))
            && (this.getUserCount() == null ? other.getUserCount() == null : this.getUserCount().equals(other.getUserCount()))
            && (this.getLoadPattern() == null ? other.getLoadPattern() == null : this.getLoadPattern().equals(other.getLoadPattern()))
            && (this.getDuration() == null ? other.getDuration() == null : this.getDuration().equals(other.getDuration()))
            && (this.getRequestUrl() == null ? other.getRequestUrl() == null : this.getRequestUrl().equals(other.getRequestUrl()))
            && (this.getRequestParams() == null ? other.getRequestParams() == null : this.getRequestParams().equals(other.getRequestParams()))
            && (this.getCreatedTime() == null ? other.getCreatedTime() == null : this.getCreatedTime().equals(other.getCreatedTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()))
            && (this.getHttpMethod() == null ? other.getHttpMethod() == null : this.getHttpMethod().equals(other.getHttpMethod()))
            && (this.getCustomHeaders() == null ? other.getCustomHeaders() == null : this.getCustomHeaders().equals(other.getCustomHeaders()))
            && (this.getRequestBody() == null ? other.getRequestBody() == null : this.getRequestBody().equals(other.getRequestBody()))
            && (this.getRampUpTime() == null ? other.getRampUpTime() == null : this.getRampUpTime().equals(other.getRampUpTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getLoadId() == null) ? 0 : getLoadId().hashCode());
        result = prime * result + ((getTargetService() == null) ? 0 : getTargetService().hashCode());
        result = prime * result + ((getUserCount() == null) ? 0 : getUserCount().hashCode());
        result = prime * result + ((getLoadPattern() == null) ? 0 : getLoadPattern().hashCode());
        result = prime * result + ((getDuration() == null) ? 0 : getDuration().hashCode());
        result = prime * result + ((getRequestUrl() == null) ? 0 : getRequestUrl().hashCode());
        result = prime * result + ((getRequestParams() == null) ? 0 : getRequestParams().hashCode());
        result = prime * result + ((getCreatedTime() == null) ? 0 : getCreatedTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
        result = prime * result + ((getHttpMethod() == null) ? 0 : getHttpMethod().hashCode());
        result = prime * result + ((getCustomHeaders() == null) ? 0 : getCustomHeaders().hashCode());
        result = prime * result + ((getRequestBody() == null) ? 0 : getRequestBody().hashCode());
        result = prime * result + ((getRampUpTime() == null) ? 0 : getRampUpTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", loadId=").append(loadId);
        sb.append(", targetService=").append(targetService);
        sb.append(", userCount=").append(userCount);
        sb.append(", loadPattern=").append(loadPattern);
        sb.append(", duration=").append(duration);
        sb.append(", requestUrl=").append(requestUrl);
        sb.append(", requestParams=").append(requestParams);
        sb.append(", createdTime=").append(createdTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", isDelete=").append(isDelete);
        sb.append(", httpMethod=").append(httpMethod);
        sb.append(", customHeaders=").append(customHeaders);
        sb.append(", requestBody=").append(requestBody);
        sb.append(", rampUpTime=").append(rampUpTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}